-- CALC_CAVE_HIDE_SHELF

-- 计算奇怪的书架奖励
-- @param user 玩家对象
return function(user)
    local ret = {};

    local bonusTimes = CaveHideItemM.getCaveBuildingBonusTimes(794);

    ret["bonus"] = {{1, 7390, 1}};

    local bonusList1 = {[1] = {["bonus"] = {2, "money", "5000~10000"}, ["ratio"] = 40},
                    [2] = {["bonus"] = {2, "money", "10000~20000"}, ["ratio"] = 30},
                    [3] = {["bonus"] = {2, "money", "20000~30000"}, ["ratio"] = 15},
    };


    local bonusList2 = {[1] = {["bonus"] = {2, "money", "5000~10000"}, ["ratio"] = 40},
                    [2] = {["bonus"] = {2, "money", "10000~20000"}, ["ratio"] = 30},
                    [3] = {["bonus"] = {2, "money", "20000~30000"}, ["ratio"] = 15},
                    [4] = {["bonus"] = {2, "gem", 3}, ["ratio"] = 15},
    };

    local bonusList = bonusList1;

    -- 抽取奖励信息
    if bonusTimes < 3 then
        bonusList = bonusList2;
    end

    -- 根据权重抽取
    local rand = DungeonM.getRandSeed("hide_shelf_bonus");
    local shelfBonusInfo = fetchElemBySeed(bonusList, rand);

    -- 记录下抽取到的奖励
    CaveHideItemM.recordHideShelfBonus(shelfBonusInfo["bonus"]);

    return ret;
end
